package com.utils;

import java.net.InetAddress;

/**
 * Created on IDEA. 获取本机的相关参数信息
 * User: lyh
 * Date: 2017/7/21
 * Time: 14:08
 */
public class CommonUtils {

    public static String getPcIp(){
        InetAddress inetAddress = null;
        String ip = null;
        try {
            inetAddress = inetAddress.getLocalHost();
            ip =inetAddress.getHostAddress();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ip;
    }
    public static String getPcName(){
        InetAddress inetAddress = null;
        String localname= null;
        try {
            inetAddress = inetAddress.getLocalHost();
            localname = inetAddress.getHostName();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return localname;
    }
    public static void main(String[] args){
    }
}
